﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceProcess;
using System.Configuration;

namespace WeChartWorkRobot
{
    class Program
    {
        static void Main(string[] args)
        {
            string env = ConfigurationManager.AppSettings["Env"];
            if (!string.IsNullOrEmpty(env) && env == "dev")
            {
                AppRuntime.Initialize();

                System.Diagnostics.Debug.WriteLine("机器人以调试模式启动，按回车键退出全部相关进程");
                Console.ReadLine();

                AppRuntime.Shutdown();
            }
            else if (args.Length > 0 && args[0].Equals("debug", StringComparison.OrdinalIgnoreCase))
            {
                AppRuntime.Initialize();

                System.Diagnostics.Debug.WriteLine("机器人以调试模式启动，按回车键退出全部相关进程");
                Console.ReadLine();

                AppRuntime.Shutdown();
            }
            else
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                new Service1()
                };
                ServiceBase.Run(ServicesToRun);
            }
        }
    }
}
